package com.zhiche.lisa.integration.controller;

import com.zhiche.lisa.core.supports.RestfulResponse;
import com.zhiche.lisa.integration.dto.order.ShipmentDTO;
import com.zhiche.lisa.integration.service.PodService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pod")
@Api(value = "otm回单接口", description = "otm回单接口", tags = {"otm回单接口"})
public class PodController {

    private static final Logger logger = LoggerFactory.getLogger(PodController.class);

    @Autowired
    PodService podService;

    @PostMapping(value = "/synPodStatus")
    @ApiOperation(value = "同步回单状态", notes = "同步回单状态", response = RestfulResponse.class)
    public RestfulResponse<ShipmentDTO> getOtmShipmentById(@RequestBody String param) {
        logger.info("controller:/pod/synPodstatus data: {}", param);
        RestfulResponse<ShipmentDTO> result = new RestfulResponse<>(0, "成功", null);
        try {
            podService.synPodStatus(param);
            return result;
        } catch (Exception e) {
            result.setCode(-1);
            result.setMessage(e.getMessage());
            return result;
        }
    }
}
